*******************************************************
*******************************************************
****** THIS PROGRAM PRODUCES RESULTS FOR TABLE 8 ******
*******************************************************
*******************************************************

clear 
cd "\\file\UsersW$\wrr15\Home\My Documents\My Files\TAXES AND ECONOMIC GROWTH IN OECD COUNTRIES - A META-ANALYSIS\SUBMISSION TO PFR\DATA AND PROGRAMS"
log using "Part3 Results(20200102).smcl", replace
set more off
set type double 
graph drop _all
import excel "TAX.xlsx", sheet("Stata") firstrow case (lower)
gen endog = (tsls == 1 | gmm == 1)
gen predamb = predother

// Creating Dummy Variables for Subdividing TaxNegative
gen predneglabor = 0
gen prednegcapital = 0
gen prednegother = 0
replace predneglabor = 1 if predneg == 1 & labourtax == 1
replace prednegcapital = 1 if predneg == 1 & capitaltax == 1
replace prednegother = predneg - predneglabor - prednegcapital
tab predneg 
tab predneglabor 
tab prednegcapital 
tab prednegother

// Creating Dummy Variables for Subdividing TaxAmbiguous
gen predamblabor = 0
gen predambcapital = 0
gen predambother = 0
replace predamblabor = 1 if predamb == 1 & labourtax == 1
replace predambcapital = 1 if predamb == 1 & capitaltax == 1
replace predambother = predamb - predamblabor - predambcapital
tab predamb
tab predamblabor 
tab predambcapital 
tab predambother

quietly summ coefficient, detail
scalar low = r(p5)
scalar high = r(p95)
keep if coefficient > low & coefficient < high

// For later Random Effects estimation
metareg coefficient peerreviewed pubyear cs length midyear gdp marginal differenced etr  ///
investment tradeopenness human popgrowth employgrowth unemployment inflation income laggeddv ///
countryfe sehac sehet lrcase2 lrcase3 gls endog eu15 g7 eumem ///
labourtax capitaltax othertaxes mixedtaxes overalltax predneg predpos se, wsse(se)
scalar tau2 = e(tau2)

*--------------------------------------------------------------------------------*
*   TABLE 8: Estimates of Tax Effects with Control Variables                     *
*--------------------------------------------------------------------------------*
// FIXED EFFECTS

// Generating transformed variables for FE
gen feprecision = 1/se
gen fetstat = coefficient/se
gen predneglaborr = predneglabor/se
gen prednegcapitall = prednegcapital/se
gen prednegotherr = prednegother/se
gen predamblaborr = predamblabor/se
gen predambcapitall = predambcapital/se
gen predambotherr = predambother/se
gen predposs = predpos/se
gen peerreviewedd = peerreviewed/se
gen pubyearr = pubyear/se
gen css = cs/se
gen lengthh = length/se
gen midyearr = midyear/se
gen gdpp = gdp/se
gen marginall = marginal/se
gen differencedd = differenced/se
gen etrr = etr/se
gen investmentt = investment/se
gen tradeopennesss = tradeopenness/se
gen humann = human/se
gen popgrowthh = popgrowth/se
gen employgrowthh = employgrowth/se
gen unemploymentt = unemploymentrate/se
gen inflationn = inflation/se
gen incomee = income/se
gen laggeddvv = laggeddv/se
gen countryfee = countryfe/se
gen sehacc = sehac/se
gen sehett = sehet/se
gen lrcase22 = lrcase2/se
gen lrcase33 = lrcase3/se
gen glss = gls/se
gen endogg = endog/se
gen eu155 = eu15/se
gen g77 = g7/se
gen eumemm = eumem/se

// TABLE 8/PANEL A
// INCLUDING ALL VARIABLES

//This regression gives equal weight to each estimate
// TABLE 8 - Panel A/Column 1
regress fetstat feprecision endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp marginall differencedd ///
etrr investmentt tradeopennesss humann popgrowthh employgrowthh unemploymentt ///
inflationn incomee laggeddvv countryfee sehacc sehett lrcase22 lrcase33 glss ///
eu155 g77 eumemm, vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel A/Column 2
regress fetstat feprecision endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp marginall differencedd ///
etrr investmentt tradeopennesss humann popgrowthh employgrowthh unemploymentt ///
inflationn incomee laggeddvv countryfee sehacc sehett lrcase22 lrcase33 glss ///
eu155 g77 eumemm [pweight = weight], vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

// TABLE 8/PANEL B
// INCLUDING ALL VARIABLES

//This regression gives equal weight to each estimate
// TABLE 8 - Panel B/Column 1
regress fetstat feprecision endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp marginall differencedd ///
etrr investmentt tradeopennesss humann popgrowthh employgrowthh unemploymentt ///
inflationn incomee laggeddvv countryfee sehacc sehett lrcase22 lrcase33 glss ///
eu155 g77 eumemm, vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel B/Column 2
regress fetstat feprecision endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp marginall differencedd ///
etrr investmentt tradeopennesss humann popgrowthh employgrowthh unemploymentt ///
inflationn incomee laggeddvv countryfee sehacc sehett lrcase22 lrcase33 glss ///
eu155 g77 eumemm [pweight = weight], vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

// TABLE 8/PANEL C
// USING BACKWARDS STEPWISE REGRESSION

//This regression gives equal weight to each estimate
// TABLE 8 - Panel C/Column 1
// This estimates the "final best equation"
regress fetstat feprecision endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd gdpp popgrowthh employgrowthh unemploymentt laggeddvv ///
countryfee sehacc lrcase22 glss eu155 g77, vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel C/Column 2
// This estimates the "final best equation"
regress fetstat feprecision endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd pubyearr lengthh midyearr differencedd popgrowthh ///
employgrowthh unemploymentt incomee countryfee sehacc lrcase33 glss eu155 g77 ///
[pweight = weight], vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

// TABLE 8/PANEL D
// USING BACKWARDS STEPWISE REGRESSION

//This regression gives equal weight to each estimate
// TABLE 8 - Panel D/Column 1
// This estimates the "final best equation"
regress fetstat feprecision endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd gdpp popgrowthh employgrowthh unemploymentt laggeddvv ///
countryfee sehacc lrcase22 glss eu155 g77, vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel D/Column 2
// This estimates the "final best equation"
regress fetstat feprecision endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd pubyearr lengthh midyearr differencedd popgrowthh ///
employgrowthh unemploymentt incomee countryfee sehacc lrcase33 glss eu155 g77 ///
[pweight = weight], vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

// RANDOM EFFECTS

// Generating transformed variables for RE

gen revar = se^2 + tau2
gen rese = sqrt(revar)
gen reprecision = 1/rese
gen retstat = coefficient/rese
gen repubbias = se/rese
replace predneglaborr = predneglabor/rese
replace prednegcapitall = prednegcapital/rese
replace prednegotherr = prednegother/rese
replace predamblaborr = predamblabor/rese
replace predambcapitall = predambcapital/rese
replace predambotherr = predambother/rese
replace predposs = predpos/rese
replace peerreviewedd = peerreviewed/rese
replace pubyearr = pubyear/rese
replace css = cs/rese
replace lengthh = length/rese
replace midyearr = midyear/rese
replace gdpp = gdp/rese
replace marginall = marginal/rese
replace differencedd = differenced/rese
replace etrr = etr/rese
replace investmentt = investment/rese
replace tradeopennesss = tradeopenness/rese
replace humann = human/rese
replace popgrowthh = popgrowth/rese
replace employgrowthh = employgrowth/rese
replace unemploymentt = unemploymentrate/rese
replace inflationn = inflation/rese
replace incomee = income/rese
replace laggeddvv = laggeddv/rese
replace countryfee = countryfe/rese
replace sehacc = sehac/rese
replace sehett = sehet/rese
replace lrcase22 = lrcase2/rese
replace lrcase33 = lrcase3/rese
replace glss = gls/rese
replace endogg = endog/rese
replace eu155 = eu15/rese
replace g77 = g7/rese
replace eumemm = eumem/rese

// TABLE 8/PANEL A
// INCLUDING ALL VARIABLES

//This regression gives equal weight to each estimate
// TABLE 8 - Panel A/Column 3
regress retstat reprecision repubbias endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp ///
marginall differencedd etrr investmentt tradeopennesss humann popgrowthh ///
employgrowthh unemploymentt inflationn incomee laggeddvv countryfee sehacc ///
sehett lrcase22 lrcase33 glss eu155 g77 eumemm, noc vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel A/Column 4
regress retstat reprecision repubbias endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp ///
marginall differencedd etrr investmentt tradeopennesss humann popgrowthh ///
employgrowthh unemploymentt inflationn incomee laggeddvv countryfee sehacc ///
sehett lrcase22 lrcase33 glss eu155 g77 eumemm [pweight = weight],  ///
noc vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

// TABLE 8/PANEL B
// INCLUDING ALL VARIABLES

//This regression gives equal weight to each estimate
// TABLE 8 - Panel B/Column 3
regress retstat reprecision repubbias endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp ///
marginall differencedd etrr investmentt tradeopennesss humann popgrowthh ///
employgrowthh unemploymentt inflationn incomee laggeddvv countryfee sehacc ///
sehett lrcase22 lrcase33 glss eu155 g77 eumemm, noc vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel B/Column 4
regress retstat reprecision repubbias endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs peerreviewedd pubyearr css lengthh midyearr gdpp ///
marginall differencedd etrr investmentt tradeopennesss humann popgrowthh ///
employgrowthh unemploymentt inflationn incomee laggeddvv countryfee sehacc ///
sehett lrcase22 lrcase33 glss eu155 g77 eumemm [pweight = weight],  ///
noc vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

// TABLE 8/PANEL C
// USING BACKWARDS STEPWISE REGRESSION

//This regression gives equal weight to each estimate
// TABLE 8 - Panel C/Column 3
// This estimates the "final best equation"
regress retstat reprecision repubbias endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs pubyearr midyearr gdpp differencedd popgrowthh ///
unemploymentt inflationn incomee sehacc lrcase22 lrcase33 eu155 g77, noc vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel C/Column 4
// This estimates the "final best equation"
regress retstat reprecision repubbias endogg  ///
predneglaborr prednegcapitall prednegotherr ///
predposs pubyearr gdpp differencedd popgrowthh inflationn incomee ///
sehacc lrcase33 [pweight = weight], noc vce(cluster idstudy)
test (predneglaborr = prednegotherr = prednegcapitall) 

// TABLE 8/PANEL D
// USING BACKWARDS STEPWISE REGRESSION

//This regression gives equal weight to each estimate
// TABLE 8 - Panel D/Column 3
// This estimates the "final best equation"
regress retstat reprecision repubbias endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs pubyearr midyearr gdpp differencedd popgrowthh ///
unemploymentt inflationn incomee sehacc lrcase22 lrcase33 eu155 g77, noc vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

//This regression gives equal weight to each study
// TABLE 8 - Panel D/Column 4
// This estimates the "final best equation"
regress retstat reprecision repubbias endogg  ///
predamblaborr predambcapitall predambotherr ///
predposs pubyearr gdpp differencedd popgrowthh inflationn incomee ///
sehacc lrcase33 [pweight = weight], noc vce(cluster idstudy)
test (predamblaborr = predambotherr = predambcapitall) 

log close
